package com.ttx.pattern.example.observer.java;

import com.ttx.pattern.example.observer.java.observers.ReaderA;
import com.ttx.pattern.example.observer.java.observers.ReaderB;

/**
 * 
 * 使用java内置的api实现并测试
 * @author TimFruit
 * @date 2019/5/21 14:17
 */

public class Client {
    public static void main(String[] args) {
        Magazine magazine=new Magazine();

        ReaderA readerA=new ReaderA();
        magazine.addObserver(readerA);
        ReaderB readerB=new ReaderB();
        magazine.addObserver(readerB);
        magazine.updateContent("第一章");

        magazine.deleteObserver(readerA);
        magazine.updateContent("第二章");
    }
}
